﻿using Ext.Net.MVC;
using System;
using System.Collections.Generic;
using Ext.Net;
using Sharp.Portal;
using Sharp.Portal.ExtNet;
using Sharp.Portal.Mvc.List;
using Sharp.Portal.Other;
using Column = Ext.Net.MVC.ColumnAttribute;
using DateColumn = Ext.Net.MVC.DateColumnAttribute;
namespace Sharp.WebBooter.Areas.Platform.Models
{
    [Title("岗位管理")]
    [DataHandler(ModuleOP.Details, "浏览", 0)]
    [DataHandler(ModuleOP.Create, "新增", 1)]
    [DataHandler(ModuleOP.Edit, "修改", 2)]
    [DataHandler(ModuleOP.Delete, "删除", 3)]
    [DataHandler(ModuleOP.Refresh, "刷新", 4)]
    public partial class JobIndexModel : ExtSharpList
    {

        public JobIndexModel()
        {
            this.Feature = ListFeature.MultiSelect | ListFeature.Paging | ListFeature.RowNumber;
            this.IsUseOrgTreeLayout = true;
            this.ToolbarButtonParameters.Add(new ToolButtonInfo()
            {
                Mode = ModuleOP.Create,
                //Parameters = new List<ToolButtonInfo.Parameter>()
                //{
                //    new ToolButtonInfo.Parameter("orgId",
                //        "Model.OrgId", (int) ParameterMode.Auto)

                //}
            });
        }

        protected override void InitQueryPanel()
        {
            base.InitQueryPanel();
            this.QueryItems.Add(new QueryItem()
            {
                Name = "ParentId",
                QueryFeatureOption = QueryFeature.Queryable,
                IsHiddenField = true,
                ValueFrom = QueryItem.ValueFromType.ValueFromModel,
                ValueFromName = nameof(OrgId)
            });
        }

        /// <summary>
        /// 主键Id
        /// </summary>
        /// <value>主键Id</value>
        [Column(Hidden = true)]
        public Guid Id { get; set; }

        /// <summary>
        /// 名称
        /// </summary>
        /// <value>标题</value>
        [Column(Width = 200, Text = "名称"), QueryOption(Option = QueryFeature.DefualtQuery)]
        public string Title { get; set; }

        /// <summary>
        /// 职级
        /// </summary>
        [Column(Width = 120, Text = "职级"), MasterData("Grade")]
        public string GradeCode { get; set; }
        /// <summary>
        /// 归属组织
        /// </summary>
        [Column(Width = 120, Text = "归属组织", DataIndex = "Org.OrgPath", Sortable = false)]
        public string OrgTitle { get; set; }
        /// <summary>
        /// 入职资质
        /// </summary>
        [Column(Width = 250, Text = "入职资质")]
        public string Qualifications { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [Column(Width = 250, Text = "备注")]
        public string Remark { get; set; }


        /// <summary>
        /// 修改时间
        /// </summary> 
        [DateColumn(Width = 144, Text = "修改时间", Format = "yyyy-MM-dd HH:mm:ss")]
        public System.DateTime? ModifiTime { get; set; }

        public Guid OrgId { get; set; }
    }

}